package com.tian.framework.security.config;

import com.tian.framework.security.domian.SecurityUser;
import org.keycloak.adapters.spi.KeycloakAccount;
import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;
import java.util.List;

/**
 * 继承KeycloakAuthenticationToken，实现新增字段获取自定义用户信息
 */
public class OwnKeycloakToken extends KeycloakAuthenticationToken {
    public OwnKeycloakToken(KeycloakAccount account, boolean interactive) {
        super(account, interactive);
    }

    public OwnKeycloakToken(KeycloakAccount account, boolean interactive, Collection<? extends GrantedAuthority> authorities) {
        super(account, interactive, authorities);
    }
    private SecurityUser securityUser;

    public SecurityUser getSecurityUser() {
        return securityUser;
    }

    public void setSecurityUser(SecurityUser securityUser) {
        this.securityUser = securityUser;
    }
}
